module.exports = {
  mode: 'universal',
  /*
   ** Headers of the page
   */
  server: {
    port: 3000,
    host: '0.0.0.0'
  },
  head: {
    // title: process.env.npm_package_name || '',
    title: 'nuxt练习',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      {
        hid: 'description',
        name: 'description',
        content: process.env.npm_package_description || ''
      }
    ],
    link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
  },
  /*
   ** Customize the progress-bar color
   */
  loading: { color: '#fff' },
  /*
   ** Global CSS
   */
  css: ['element-ui/lib/theme-chalk/index.css'],
  /*
   ** Plugins to load before mounting the App
   */
  plugins: ['@/plugins/element-ui', '@/plugins/request', '@/plugins/day.js'],
  /*
   ** Nuxt.js dev-modules
   */
  buildModules: [
    // Doc: https://github.com/nuxt-community/eslint-module
    '@nuxtjs/eslint-module'
  ],
  /*
   ** Nuxt.js modules
   */
  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    '@nuxtjs/axios'
  ],
  /*
   ** Axios module configuration
   ** See https://axios.nuxtjs.org/options
   */
  axios: {},
  /*
   ** Build configuration
   */
  build: {
    transpile: [/^element-ui/],
    /*
     ** You can extend webpack config here
     */
    extend(config, ctx) {}
  },
  router: {
    linkActiveClass: 'active',
    extendRoutes(routes, resolve) {
      routes.splice(0)
      routes.push(
        ...[
          {
            path: '/',
            component: resolve(__dirname, 'pages/layout/index.vue'),
            children: [
              {
                path: '/',
                name: 'Home',
                component: resolve(__dirname, 'pages/Home/index.vue')
              },
              {
                path: '/login',
                name: 'Login',
                component: resolve(__dirname, 'pages/Login/index.vue')
              },
              {
                path: '/register',
                name: 'Register',
                component: resolve(__dirname, 'pages/Login/index.vue')
              },
              {
                path: '/profile/:username',
                name: 'Profile',
                component: resolve(__dirname, 'pages/Profile/index.vue')
              },
              {
                path: '/settings',
                name: 'Settings',
                component: resolve(__dirname, 'pages/Settings/index.vue')
              },
              {
                path: '/editor',
                name: 'Editor',
                component: resolve(__dirname, 'pages/Editor/index.vue')
              },
              {
                path: '/article/:slug',
                name: 'Article',
                component: resolve(__dirname, 'pages/Article/index.vue')
              }
            ]
          }
        ]
      )
    }
  }
}
